{% extends 'partial/layout.njk' %}

{% block body %}
  <header class='demos-header'>
    <a href='/'>
      <h1 class="demos-title">布置作业</h1>
    </a>
    <p class="demos-sub-title">
      欢迎
      被牧养人，每天进步一点点
    </p>
  </header>

  <div class="bd">
    <div class="page__bd">
      <form>
      <div class="weui-cells__title">任务内容</div>
        <div class="weui-cells weui-cells_form">
       <div class="weui-cell">
                <div class="weui-cell__bd">
                    <input class="weui-input  open-popup" data-target="#half" 
                        type="text" id="tk" name="tk">
                </div>
            </div>
      </div>

        <div class='demos-content-padded'>
            
                <label class="weui-label  open-popup">关键字：</label> 
                <label class="weui-btn weui-btn_mini weui-btn_default  open-popup" data-target="#half1">查经</label> 
                <label class="weui-btn weui-btn_mini weui-btn_default  open-popup" data-target="#half2">打击蛇的灵</label> 
            
          
        </div>

        <div id="half1" class='weui-popup__container popup-bottom'>
            <div class="weui-popup__overlay"></div>
            <div class="weui-popup__modal">
                <header class='demos-header'>
                    <h2 class="demos-second-title">参考作业</h2>
                </header>
                {%for task in keyTask %}
                    <div class="weui-cell">
                        <label class="weui-label  close-popup" 
                            name="mem" id="mem" 
                            onclick="setRefTask('{{task.name}}')" >{{task.name}}</label> 
                    </div>
                {% endfor %}

                     <div class="weui-cell">
                        <label class="weui-label  close-popup" 
                            name="mem" id="mem" 
                            onclick="setRefTask('相关任务A')" >相关任务A</label> 
                    </div>
                    <div class="weui-cell">
                        <label class="weui-label  close-popup" 
                            name="mem" id="mem" 
                            onclick="setRefTask('相关任务B')" >相关任务B</label> 
                    </div>

           </div>
        </div>
       

      <div class="demos-content-padded">
          <button class="weui-btn weui-btn_primary" type="submit">确定</button>
        </div>

      </form>

       <div class="weui-cells__title">历史汇报</div>

      <div class="weui-panel__bd">
      <div class="weui-media-box weui-media-box_text">
      <h4 class="weui-media-box__title">概要</h4>
          <p class="weui-media-box__desc">任务内容</p>
          <p class="weui-media-box__desc">操练随时多方灵里祷告教导后肩膀和鼻子都完全松开了</p>
              
      <ul class="weui-media-box__info">
                <li class="weui-media-box__info__meta">2018-06-02</li>
                <li class="weui-media-box__info__meta weui-media-box__info__meta_extra">服侍</li>
      </ul>
      </div>       
     </div>  

     <div class="weui-panel__bd">
      <div class="weui-media-box weui-media-box_text">
      <h4 class="weui-media-box__title">概要</h4>
          <p class="weui-media-box__desc">任务内容</p>
          <p class="weui-media-box__desc">操练随时多方灵里祷告教导后肩膀和鼻子都完全松开了</p>
              
      <ul class="weui-media-box__info">
                <li class="weui-media-box__info__meta">2018-06-02</li>
                <li class="weui-media-box__info__meta weui-media-box__info__meta_extra">服侍</li>
      </ul>
      </div>       
     </div>  
    
    </div>
  </div>

{% endblock %}


{%block script%}
    <script src="/public/js/jquery.serializejson.js"></script>
    <script>
        $("#netName").select({
            title: "选择学员",
            items: ["法官", "医生", "猎人", "学生", "记者", "其他"]
            //items: {{ allorg | dump | safe }}
        });

        $("form").submit(function(event){
            $.showLoading();
            event.preventDefault();
            
            var formData = $(this).serializeJSON();
            formData.orgId = $("#_netName").data("values");
            $.post('/task/create', formData, function(data){
                window.location = data.location;
            });
        });

        function setRefTask(task){
            $("#tk").val(task);
        }

    </script>
{%endblock%}
